m, n = input().split(':')
a, b = int(m), int(n)
c = 0
while True:
if a<10 and b>=10:
s = '0' + str(a) + str(b)
elif a>=10 and b<10:
s = str(a) + '0' + str(b)
elif a<10 and b<10:
s = '0' + str(a) + '0' + str(b)
else:
s = str(a) + str(b)
if s == s[::-1]:
break
else:
if a == 23 and b == 59:
a = 0
b = 0
c += 1
elif b == 59:
a += 1
b = 0
c += 1
else:
b += 1
c += 1
print(c)
#include <bits/stdc++.h>
using namespace std;
int b1,b2,c1,c2;
string s;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >> s;
b1 = (s[0]-'0')*10+(s[1]-'0');
b2 = (s[3]-'0')*10+(s[4]-'0');
c1 = b1*60+b2;
if((b1==5 && b2>50) || (b1>5 && b1<10))
{
c2 = 601;
}
else
{
if((b1==15 && b2>51) || (b1>15 && b1<20))
{
c2 = 1202;
}
else
{
if(b2<=(b1%10)*10+b1/10)
{
c2 = b1*60+(b1%10)*10+b1/10;
}
else
{
if(b1==23)
{
c2 = 0;
}
else
{
b1++;
c2 = b1*60 + (b1%10)*10+b1/10;
}
}
}
}
cout << (1440+c2-c1)%1440 <<endl;
return 0;
}
822B - Crossword solving | 1623A - Robot Cleaner |
884B - Japanese Crosswords Strike Back | 862B - Mahmoud and Ehab and the bipartiteness |
429A - Xor-tree | 1675C - Detective Task |
950A - Left-handers Right-handers and Ambidexters | 672B - Different is Good |
1C - Ancient Berland Circus | 721A - One-dimensional Japanese Crossword |
1715B - Beautiful Array | 60B - Serial Time |
453A - Little Pony and Expected Maximum | 1715A - Crossmarket |
1715C - Monoblock | 1512C - A-B Palindrome |
1679B - Stone Age Problem | 402A - Nuts |
792A - New Bus Route | 221A - Little Elephant and Function |
492C - Vanya and Exams | 1369B - AccurateLee |
892B - Wrath | 999A - Mishka and Contest |
727C - Guess the Array | 1625C - Road Optimization |
1715D - 2+ doors | 267A - Subtractions |
1582A - Luntik and Concerts | 560A - Currency System in Geraldion |